package com.hospital.controller;

import com.hospital.entity.User;
import com.hospital.service.UserService;
import com.hospital.vo.ResponseVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 用户控制层类
 * @author coder_zzm
 * @date 2022/5/22 16:45
 */
@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 用户注册
     * @param user 实体类
     * @return 是否注册成功
     */
    @PostMapping("/userRegistration")
    public ResponseVO userRegistration(User user) {
        log.info("控制层注册用户信息...");
        return userService.userRegistration(user);
    }

    /**
     * 用户登录
     * @param user 实体类
     * @return 是否登录成功
     */
    @PostMapping("/addLogin")
    public ResponseVO addLogin(User user) {
        log.info("控制层开始登录用户...");
        return userService.userLogin(user);
    }
}
